package controller;

import controller.Editor.IGraphEditorController;
import controller.Editor.ISemanticController;
import controller.Editor.ISyntaxController;
import controller.Editor.ITextEditorController;
import controller.Editor.TextEditorController;
import UI.EditorsUI;

public class EditorsController implements IEditorsController {

	private IMainController mMainController;

	private ITextEditorController mTextC;
	private IGraphEditorController mGraphC;
	private ISemanticController mSemC;
	private ISyntaxController mSyntaxC;
	
	private EditorsUI mView;
	
	public EditorsController(IMainController topController) {
		mMainController = topController;
		
		mTextC = new TextEditorController(this);
		
		// Los otros no son inicializados
	}
	@Override
	public void loadText(String s) {
		mTextC.loadText(s);
	}
	
	@Override
	public String getText() {		
		return mTextC.getText();
	}

	public EditorsUI getView() {
		return mView;
	}
	
	@Override
	public void setView(EditorsUI mView) {
		this.mView = mView;
		this.mView.setController(this);
		this.assingViewsToControllers();
	}
	
	private void assingViewsToControllers(){
		mTextC.setView(mView.getTextMode());
		// Asginar los otros controladores cuando esten listos
	}
}
